LearningStore Constructor (string, string, ImpersonationBehavior)

Initializes a new instance of the LearningStore class.

Parent Type: LearningStore

Namespace: Microsoft.LearningComponents.Storage

Assembly: Microsoft.LearningComponents.Storage.dll

Syntax
C#

public LearningStore (
string connectionString,
string userKey,
ImpersonationBehavior impersonationBehavior

)

Parameters

connectionString

The connection used to access the SQL server database. The string is the same format as a connection string passed to System.Data.SqlClient.SqlConnection

userKey

The unique key of the user accessing the database.

impersonationBehavior

Identifies which WindowsIdentity is used to access the database when impersonation is involved.

Exceptions
Exception type Condition
ArgumentNullException

connectionString or userKey is a null reference.

ArgumentOutOfRangeException

impersonationBehavior has an invalid value

Example

The following code opens the store located in the "Mls" database of the "Learning" server with the user key "Bob". The original (non-impersonated) identity is used when accessing the database:

C#
LearningStore store = new LearningStore("Server=Learning;Database=Mls;Integrated Security=true", "Bob", ImpersonationBehavior.UseOriginalIdentity);